package com.hnhn.c68.ch6.controller;

import com.hnhn.c68.ch6.pojo.Result;
import com.hnhn.c68.ch6.pojo.Student;
import com.hnhn.c68.ch6.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/student")
//@CrossOrigin
public class StudentController {
    @Autowired
    StudentService studentService;

    @GetMapping
    public Result<?> list() {
        List<Student> studentList = studentService.list();
        return Result.success(studentList);
    }
}
